package cn.edu.zafu.bigdata.yt.wjcz2;

import java.util.Scanner;

public class StudentManagementSystem_yt {
    public static void main(String[] args) {
        StudentManager_yt manager = new StudentManager_yt();
        Scanner scanner = new Scanner(System.in);

        while (true) {
            System.out.println("======= 学生信息管理系统 =======");
            System.out.println("1. 添加学生信息");
            System.out.println("2. 检索学生信息");
            System.out.println("3. 更新学生信息");
            System.out.println("4. 删除学生信息");
            System.out.println("5. 退出程序");
            System.out.print("请输入操作编号 (1-5): ");

            int choice;
            try {
                choice = Integer.parseInt(scanner.nextLine());
            } catch (NumberFormatException e) {
                System.out.println("Invalid input. Please enter a number between 1 and 5.");
                continue;
            }

            switch (choice) {
                case 1:
                    manager.addStudent();
                    break;
                case 2:
                    manager.searchStudent();
                    break;
                case 3:
                    manager.updateStudent();
                    break;
                case 4:
                    manager.deleteStudent();
                    break;
                case 5:
                    System.out.println("Exiting the system. Goodbye!");
                    return;
                default:
                    System.out.println("Invalid choice. Please enter a number between 1 and 5.");
            }
        }
    }
}
